package com.itheima.controller;

import com.itheima.common.constant.MessageConstant;
import com.itheima.common.entity.Result;
import com.itheima.service.ValidatecodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/validatecode")


public class ValidatecodeController {
    @Autowired
    ValidatecodeService validatecodeService;

    @PostMapping("/send4Order")
    Result send4Order(String telephone){
        log.info("向手机号{}发送验证码啊",telephone);
      validatecodeService.send4Oreder(telephone);
        return new Result(true, MessageConstant.SEND_VALIDATECODE_SUCCESS);
    }
    @GetMapping("/send4Login")
    Result send4Login(String telephone){
        log.info("向手机号{}发送验证码啊",telephone);
        validatecodeService.send4Login(telephone);
        return new Result(true, MessageConstant.SEND_VALIDATECODE_SUCCESS);
    }

}
